<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>convex_hull</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab function</center>
    <div align="right">Last update : September 1996</div>
    <p>
      <b>convex_hull</b> -  convex hull of a set of points in the plane</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>[nhull,ind] = convex_hull(xy)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>xy</b>
        </tt>: 2 x n real matrix</li>
      <li>
        <tt>
          <b>nhull</b>
        </tt>: integer</li>
      <li>
        <tt>
          <b>ind</b>
        </tt>: integer row vector</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>convex_hull</b>
      </tt> finds the convex hull of a given set of n points in
    the plane. <tt>
        <b>xy</b>
      </tt> is the 2 x n matrix of the (x,y) coordinates of
    the given points. <tt>
        <b>convex_hull</b>
      </tt> returns in <tt>
        <b>nhull</b>
      </tt> the number
    of the points of the boundary of the convex hull and in <tt>
        <b>ind</b>
      </tt> the
    row vector (of size <tt>
        <b>nhull</b>
      </tt>) giving the indices in <tt>
        <b>xy</b>
      </tt> of the
    points of the boundary. The order in <tt>
        <b>ind</b>
      </tt> corresponds to
    consecutive points on the boundary.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

ta=[27 27 3 12 11 12 27 26 26 25 25 24 23 23 21 22 21 20 19 18 18];
ta=[ta  16 15 15 14 12 9 10 6 9 17 8 17 10 20 11 23 23 12 18 28]; 
he=[ 1  2 2  4  5 11 13  1 25 22 24 22 22 19 13 13 14 16 16  9 16];
he=[he  10 10 11 12  2 6  5 5 7  8 7  9  6 11  4 18 13  3 28 17];
g=make_graph('foo',0,28,ta,he);
xx=[46 120 207 286 366 453 543 544 473 387 300 206 136 250 346 408];
g('node_x')=[xx 527 443 306 326 196 139 264  55  58  46 118 513];
yy=[36  34  37  40  38  40  35 102 102  98  93  96 167 172 101 179];
g('node_y')=[yy 198 252 183 148 172 256 259 258 167 109 104 253];
show_graph(g);
xy=[g('node_x');g('node_y')];
[nhull,ind] = convex_hull(xy)
show_nodes(ind);
 
  </pre>
  </body>
</html>
